package com.it.liulang;

import com.it.liulang.config.SpringConfig;
import com.it.liulang.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

//使用spring提供的SpringJUnit4ClassRunner进行测试
@RunWith(SpringJUnit4ClassRunner.class)
//指定测试文件 使用xml
//@ContextConfiguration("classpath:applicationContext.xml")
//使用配置类
@ContextConfiguration(classes = SpringConfig.class)
public class SpringJunit {
    @Autowired
    private UserService userService;

    @Test
    public void test1(){
        userService.save();
    }
}
